package com.qiyu.mq.core.serializer;

import com.alibaba.fastjson.JSON;

/**
 * @Author idea
 * @Date created in 8:16 上午 2020/8/25
 */
public class FastJsonSerializer implements Serializer {

    @Override
    public <T> byte[] serializer(T object) {
        return JSON.toJSONBytes(object);
    }

    @Override
    public <T> T serializer(byte[] bytes, Class<T> clazz) {
        return JSON.parseObject(bytes,clazz);
    }
}
